//
//  CPSCVideoShortVideoViewController.m
//  CPSCustomer
//
//  Created by hl on 2021/8/30.
//  Copyright © 2021 dgg_hzk. All rights reserved.
//

#import "CPSCVideoShortVideoViewController.h"
#import "CPSCVideoShortVideoTBCell.h"
#import "CPSCVideoFilterListCategoryView.h"

@interface CPSCVideoShortVideoViewController ()<UITableViewDelegate, UITableViewDataSource>


@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray * dataArray;
@property (nonatomic, assign) NSInteger page;

@property (nonatomic, strong) CPSCVideoFilterListCategoryView * viewCategoryContent;
@property (nonatomic, strong) UIView * viewCategorySuper;
@end

static NSString * CPSCVideoShortVideoTBCellIdentifier = @"CPSCVideoShortVideoTBCell";

@implementation CPSCVideoShortVideoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self setUpMainUI];
}

- (void)setUpMainUI
{
    [self.view addSubview:self.viewCategorySuper];
    [self.viewCategorySuper addSubview:self.viewCategoryContent];
    [self.view addSubview:self.tableView];
    
    [self makeContraints];
    [self debugUI];
}


- (void)makeContraints {
    
    [self.viewCategorySuper mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.height.mas_equalTo(48);
        make.top.left.right.mas_equalTo(0);
    }];
    
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewCategorySuper.mas_bottom);
        make.bottom.left.right.mas_equalTo(0);
        
    }];
    
    [self.viewCategoryContent mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.bottom.left.right.mas_equalTo(0);
    }];
    
}

- (void)debugUI
{
//    self.view.backgroundColor = [UIColor redColor];
//    self.tableView.backgroundColor = UIColor.yellowColor;
    
//    self.viewCategorySuper.backgroundColor = UIColor.yellowColor;
    
}


#pragma mark - Getter-Setter

- (UITableView *)tableView {
    if (!_tableView) {
        _tableView = [UITableView new];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.showsVerticalScrollIndicator = NO;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableView.backgroundColor = [UIColor colorWithHexString:@"#F5F5F5"];//][CPSCustomerTheme colorF8F8F8];
//        _tableView.sectionHeaderHeight = 0;
//        _tableView.sectionFooterHeight = 0;
//        _tableView.scrollEnabled = NO;
//        [_tableView registerClass:[CPSCGoodsDetailsRecommendPlannerCell class] forCellReuseIdentifier:NSStringFromClass([<#CPSCGoodsDetailsRecommendPlannerCell#> class])];
    }
    
    return _tableView;
}

- (UIView *)viewCategorySuper
{
    
    if (!_viewCategorySuper) {
        
        UIView * view = [[UIView alloc] init];
        view.backgroundColor = [UIColor whiteColor];
        view.clipsToBounds = YES;
        
        _viewCategorySuper = view;
    }
    return _viewCategorySuper;
}


- (CPSCVideoFilterListCategoryView *)viewCategoryContent
{
    DggWEAKSELF(weakSelf);
    if (!_viewCategoryContent) {
        
        CPSCVideoFilterListCategoryView * view = [[CPSCVideoFilterListCategoryView alloc] init];
        view.backgroundColor = [UIColor whiteColor];
        view.clipsToBounds = YES;
        
        view.blockEdit = ^{
            
        };
        
        view.blockSelect = ^(id  _Nonnull item) {
            
        };
        
        _viewCategoryContent = view;
    }
    return _viewCategoryContent;
}



#pragma mark - <UITableViewDelegate, UITableViewDataSource>
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 6;//self.dataArray.count;
}

// Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier:
// Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls)

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
//    <#MMAPIApiAnnouncementAuthHomeList#> *item = self.dataArray[indexPath.row];

    CPSCVideoShortVideoTBCell  * cell = [tableView dequeueReusableCellWithIdentifier:CPSCVideoShortVideoTBCellIdentifier];

    if (!cell) {
        
        
        
        [tableView registerClass:NSClassFromString(CPSCVideoShortVideoTBCellIdentifier) forCellReuseIdentifier:CPSCVideoShortVideoTBCellIdentifier];

        cell = [tableView dequeueReusableCellWithIdentifier:CPSCVideoShortVideoTBCellIdentifier];
    }

//    cell.backgroundColor = kCPSCRandomColor;
//    [cell updateCellWithItem:item];

    return cell;
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
//    <#MMAPIApiAnnouncementAuthHomeList#> *item = self.dataArray[indexPath.row];
//    NSLog(@"%lf", item.viewHeight);
//    return item.viewHeight;
    
    return ScreenWidth;
}


#pragma mark - request



@end
